package com.productssite.vo;

import java.io.Serializable;


import org.apache.log4j.Logger;


public abstract class ValueObject implements Serializable {

	protected Integer id;
	protected String code;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	protected transient Logger logger = Logger.getRootLogger();

	protected ValueObject(Integer id) {
		this.id = id;
	}

	protected ValueObject() {
	}

	public abstract void validate();

	/**
	 * @param objects
	 * @throws InvalidParameterException
	 * @throws ServiceException 
	 */
	public abstract void extractToValueObject(Object... objects);

	/**
	 * @param object
	 * @throws InvalidParameterException
	 */
	public abstract void extractToBusinessObject(Object object);

	public abstract Object extractToBusinessObject();

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Override
	public boolean equals(Object valueObject) {
		return ((ValueObject) valueObject) != null && id != null
				&& ((ValueObject) valueObject).getId() != null
				&& id.equals(((ValueObject) valueObject).getId());
	}

}
